/*
 * Copyright (c) 2007 Universidade Federal de Campina Grande
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
package br.edu.ufcg.threadcontrol;

public class ThreadStateManager {

	private Thread thread;
	private String state;

	public Thread getThread() {
		return thread;
	}
	public void setThread(Thread thread) {
		this.thread = thread;
	}
	public ThreadStateManager(Thread t, String state) {
		super();
		this.thread = t;
		this.state = state;
	}
	public boolean isThreadInState(String state){
		return state!= null && state.equals(this.getState());
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}


	
	public boolean equals(Object o){
		if (!(o instanceof ThreadStateManager)){
			return false;
		} else {
			ThreadStateManager tsm = (ThreadStateManager)o;
			return tsm.getState().equals(this.getState()) && tsm.getThread().equals(this.getThread());
		}
		
	}
	
	public String toString(){
		return "ThreadStateManager  for Thread:"+this.getThread()+" in state:"+this.getState();
	}

}
